<template>
  <el-dialog
    :title="title"
    width="1000px"
    :visible.sync="visible"
    :close-on-click-modal="false"
    destroy-on-close
  >
    <el-table
      :data="tableData"
      border
      style="width: 100%;"
      height="540px"
      :row-style="getRowStyle"
      :cell-style="getCellStyle"
      :header-cell-style="getHeaderCellStyle"
    >
      <el-table-column type="index" width="50" label="序号" align="center"></el-table-column>

      <el-table-column label="数据元素英文名" prop="数据元素英文名" align="center" show-overflow-tooltip/>
      <el-table-column label="数据元素中文名" prop="数据元素中文名" align="center" show-overflow-tooltip/>
      <el-table-column label="说明" prop="说明" align="left" show-overflow-tooltip/>

    </el-table>
  </el-dialog>
</template>

<script>
export default {
  name: 'DetailDialog',

  data() {
    return {
      visible: false,
      tableData: [],
    };
  },

  computed: {
    title() {
      return `疑似重复项 ${this.tableData.length} 条`;
    },
  },

  methods: {
    isShow(tableData) {
      this.visible = true;
      this.tableData = tableData;
    },
    getRowStyle({rowIndex}) {
      console.log(rowIndex, 'row');
      return {
        background: rowIndex % 2 === 1 ? '#f2f3f8': '',
      };
    },
    getHeaderCellStyle() {
      return {
        ...this.getCellStyle(),
        background: '#fcfcfc',
      };
    },
    getCellStyle() {
      return { 
        height: '32px',
        'box-sizing': 'border-box', 
        padding: 0,
        'line-height': '32px',
      }
    },
  }
}
</script>

<style lang="scss">
  .el-dialog__body {
    padding: 16px 20px;
  }

  .row-item {
    display: flex;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 16px;
    color: #162B41;

    .label {
      white-space: nowrap;
    }
  }
</style>